package com.gray.serverclientuser.controller.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created on 2019/6/23.
 *
 * @author Grak
 * @since 1.0
 */
@RestController
public class MqUser {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @RequestMapping("/sendMy")
    public void send() {
        amqpTemplate.convertAndSend("myQueue", "now " + new Date());
    }

    @RequestMapping("/sendOrder")
    public void sendOrder() {
        amqpTemplate.convertAndSend("myOrder", "computer", "now " + new Date());
    }
}
